<% decorated_comment = comment.decorate %>

<div class="comment__inner">
  <%= render partial: "comments/comment_avatar", locals: { comment: comment } %>

  <div class="inner-comment comment__details">
    <div class="comment__content crayons-card">
      <% if comment.deleted || (decorated_comment.super_low_quality && !is_admin) %>
        <div class="p-6 align-center opacity-50 fs-s">
          <span class="js-comment-username">
            <%= t("views.comments.delete.comment_deleted") %>
          </span>
        </div>
      <% else %>
        <%= render partial: "comments/comment_quality_marker", locals: {
              comment: comment,
              decorated_comment: decorated_comment
            } %>

        <%= render partial: "comments/comment_header", locals: {
              comment: comment,
              commentable: commentable,
              decorated_comment: decorated_comment
            } %>

        <div
          class="
            comment__body
            text-styles
            text-styles--secondary
            body
            <%= "color-base-60" if comment.decorate.low_quality %>
            <%= should_be_hidden?(comment, @root_comment) ? "element-hidden-by-commentable-user" : "" %>
          ">
          <%= comment.safe_processed_html %>
        </div>

        <% if should_be_hidden?(comment, @root_comment) %>
          <div class="p-6 align-center opacity-50 fs-s hidden comment-hidden-by-author-text">
            <%= t("views.comments.hidden.comment_hidden") %>
          </div>
        <% end %>
      <% end %>
    </div>

    <script>
      <%# we consider these scripts safe for embedding as they come from our code %>
      <% if comment.processed_html.include?("podcastliquidtag") %>
        <%== PodcastTag.script %>
      <% end %>
      <% if comment.processed_html.include?("tweet-embed") %>
        <%== TweetTag.script %>
      <% end %>
    </script>

    <%= unless comment.deleted || commentable.nil? || should_be_hidden?(comment, @root_comment)
          (render partial: "comments/comment_footer", locals: {
            comment: comment,
            commentable: commentable,
            is_childless: is_childless
          })
        end %>
  </div>
</div>
<%= subtree_html %>
